package com.jdk8.lambda;

import java.util.Arrays;
import java.util.List;

/**
 * description: JDK8 lambda filter demo
 * @version v1.0
 * @author w
 * @date 2018年12月7日下午3:57:12
 *
 */

public class LambdaFilter {
	
	public static void main(String[] args) {
		List<Object> obj = Arrays.asList(new Object[] {1,"abc",2,4,8});
		int cou = obj.stream().filter(ob -> ob.toString().matches("^[0-9]*$")).mapToInt(ob -> Integer.parseInt(ob.toString())).sum();
		System.out.println(cou);
	}
}
